#include <stdio.h>
int main()
{
    int m, n;
    int flag = 0;
    int num1 = 0, num2 = 1;
    int i = 0, j = 0;
    char s = 'A';
    char a[31][31];
    scanf("%d %d",&m,&n);
    a[0][0] = s;
    while(flag < m*n-1)
    {
        switch(num2%4)
        {
        case 1:
            ++j;
            if(j == n-num1-1)
            {
                num2++;
            }
            break;
        case 2:
            ++i;
            if(i == m-num1-1)
            {
                num2++;
            }
            break;
        case 3:
            --j;
            if(j == num1)
            {
                num2++;
            }
            break;
        case 0:
            --i;
            if(i == num1+1)
            {
                num2++;
                num1++;
            }
            break;
        }
        if(++s == 'Z'+1)
            s = 'A';
        a[i][j]=s;
        flag++;
    }
    for(i=0; i<m; i++)
    {
        printf(" ");
        for(j=0; j<n; j++)
        {
            if(j!=n-1)
                printf("%c ", a[i][j]);
            else
                printf("%c", a[i][j]);
        }
        printf("\n");

    }

}

